package com.jianglin.filter;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @author jianglin
 * JWT令牌过滤器
 */
public class JwtAuthenticationToken extends AbstractAuthenticationToken {
    private final UserDetails principal;
    public JwtAuthenticationToken(UserDetails principal, Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.principal = principal;
        setAuthenticated(true);
    }
    @Override
    public Object getCredentials(){
        return null;
    }
    @Override
    public Object getPrincipal() {
        return principal;
    }
}
